import { defineStore } from 'pinia';

export const useMpWxPosition = defineStore('mpWxPosition', {
    state: () => ({
        mpWxPosition: {
            top: 0,
            height: 0,
            left: 0,
            right: 0,
            width: 0,
            bothSideMargin: 0,
            headerHeight:0,
            logoTop: 0,
            logoHeight: 0,
            logoWidth: 0,
            logoUrl: ''
        }
    }),
    getters: {
        getMpWxPosition: state => state.mpWxPosition
    },
    actions: {
        updateMpWxPosition(newMpWxPosition) {
            this.mpWxPosition = Object.assign(this.mpWxPosition, newMpWxPosition)
            console.log("updateMpWxPosition:", newMpWxPosition)
        }
    },
    storeOptions: {
        openStorage: true,
        storageWay: {
            setStorageWay: (key, data) => uni.setStorageSync(key, data), // 这里将存储方法替换
            getStorageWay: (key) => uni.getStorageSync(key),
        },
        paths:['mpWxPosition']
    }
});
